<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h2>v-model修饰符</h2>
      <!-- lazy修饰符是将底层的input事件换成了change事件 -->
      <!-- 需要input失去焦点的时候触发 -->
      <input type="text" v-model.lazy="textValue" />
      <p>textValue: {{ textValue }}</p>

      <!-- number修饰符尝试将内容转成数字，parseInt -->
      <input type="text" v-model.number="value2" />
      <p>value2: {{ value2 }} - {{ typeof value2 }}</p>

      <!-- trim修饰符用于去除首尾空格, trim方法 -->
      <input type="text" v-model.trim="value3" />
      <p>value3: {{ value3 }}</p>
      <button @click="fn">btn</button>
    </div>

    <script src="./lib/vue3.js"></script>
    <script>
      const { createApp } = Vue;

      createApp({
        data() {
          return {
            textValue: "",
            value2: "",
            value3: "",
          };
        },
        methods: {
          fn() {
            console.log(this.value3);
          },
        },
      }).mount("#app");
    </script>
  </body>
</html>
